@echo off
chcp 65001 >nul

set "task1=1、检测线EFC"
set "task2=2、商品化EFC"
set "task3=3、淋雨线EFC"
set "task4=4、路试EFC"
set "task5=5、EFC返修"
set "task6=6、退出"

set "result0=0、失败"
set "result1=1、成功"
set "result2=2、待定"
set "result3=3、暂停"
set "result4=4、继续"
set "result5=5、紧急停止"

:main_menu
cls
echo 请选择任务：
echo %task1%
echo %task2%
echo %task3%
echo %task4%
echo %task5%
echo %task6%
set /p task_choice=请输入任务编号（1-6）：

if %task_choice%==6 goto end

if %task_choice% lss 1 goto main_menu
if %task_choice% gtr 5 goto main_menu

set /a tag=%task_choice%-1

:choose_result
cls
echo 请选择结果：
echo %result0%
echo %result1%
echo %result2%
echo %result3%
echo %result4%
echo %result5%
set /p result_choice=请输入结果编号（0-5）：

if %result_choice% lss 0 goto choose_result
if %result_choice% gtr 5 goto choose_result

if %result_choice%==5 goto emergency_stop

adb shell am broadcast -a com.dfl.CAR_MACHINE_CALLBACK -n com.dfl.cartest/.sysSettings.utils.CarBroadcastReceiver --ei result %result_choice% --ei tag %tag%
goto choose_result

:emergency_stop
cls
echo 紧急停止：
adb shell am broadcast -a com.dfl.CAR_MACHINE_CALLBACK -n com.dfl.cartest/.sysSettings.utils.CarBroadcastReceiver --ei result 5 --ei tag %tag%
cls
goto main_menu

:end
echo 操作完成，程序退出！
pause
